--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 8aa7913aa6930b2aea643608c254d1a982ad013b
Parents : 48abc8b
Author : Sudo-Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-01-01T17:35:14-06:00
feat(conversation): add validation for destination hash in ping functionality to ensure correct format and existence
Changes
1 files changed, 13 insertions(+), 2 deletions(-)
Diff
diff --git a/meshchatx/src/frontend/components/messages/ConversationDropDownMenu.vue b/meshchatx/src/frontend/components/messages/ConversationDropDownMenu.vue
index ccf7f334..0534e5f1 100644
--- a/meshchatx/src/frontend/components/messages/ConversationDropDownMenu.vue
+++ b/meshchatx/src/frontend/components/messages/ConversationDropDownMenu.vue
@@ -168,9 +168,20 @@ export default {
}
},
async onPingDestination() {
+ if (!this.peer || !this.peer.destination_hash) {
+ DialogUtils.alert("Invalid destination hash");
+ return;
+ }
+
+ const destinationHash = this.peer.destination_hash;
+ if (destinationHash.length !== 32 || !/^[0-9a-fA-F]+$/.test(destinationHash)) {
+ DialogUtils.alert("Invalid destination hash format");
+ return;
+ }
+
try {
// ping destination
- const response = await window.axios.get(`/api/v1/ping/${this.peer.destination_hash}/lxmf.delivery`, {
+ const response = await window.axios.get(`/api/v1/ping/${destinationHash}/lxmf.delivery`, {
params: {
timeout: 30,
},
@@ -181,7 +192,7 @@ export default {
const rttDurationString = `${rttMilliseconds} ms`;
const info = [
- `Valid reply from ${this.peer.destination_hash}`,
+ `Valid reply from ${destinationHash}`,
`Duration: ${rttDurationString}`,
`Hops There: ${pingResult.hops_there}`,
`Hops Back: ${pingResult.hops_back}`,
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────